<%@page import="sdfi.lee.Newpj.DAO.AchievementDAO"%>
<%@page import="sdfi.lee.Newpj.Entity.Product"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta content='<a href="<c:url value='/achievement/productlist.jsp?pg=1' />">区内产品</a>' name="location">
<link rel="stylesheet" href="../css/index.css">
<link rel="stylesheet" href="../css/level.css">
<script type="text/javascript" src="../js/jquery-1.6.js"></script>
<script type="text/javascript" src="../js/index.js"></script>
<script type="text/javascript">
			$(function(){
				
				
				$("a[action]").click(function(){
					
					var aget=$(this);
					if(aget.text().length<=0) return false;
					$(this).parents("tr").next("tr").css("background-color",$(this).parents("tr").css("background-color"))
					.children("td").html("正在加载...").show();
					var td=$(this);
					$.ajax({
						dataType:"text",
						type:"get",
						url:td.attr("action"),
						data:{entityName:aget.text(),t:new Date()},
						success:function(data,status){
							td.parents("tr").next("tr").children("td").html(data);
						},
					error:function(xhr,status){
						
						td.parents("tr").next("tr").children("td").html("系统出错了");
					}
					});
					td.parents("tr").siblings(".show").next().children("td").hide();
				});
			});
			
		</script>
<style type="text/css">
	<!--
	.tdclass{
			font-size:14px;
			border:1px solid #000000;
			border-left:none;
			border-bottom:none;
			word-break: break-all; word-wrap:break-word;
		}
		.thclass{
		word-break: break-all; word-wrap:break-word;
		border:1px solid #000000;
		border-left:none;
		border-bottom:none;
		border-top:none;
		font-size:18px;
		font-weight:bold;
		padding:4px 0px;
		
		}
		table{
		border:1px solid #000;
		margin-top:10px;
		}
		input{
		margin-bottom:5px;
		}
	 -->
</style>
</head>
<body>
<%
	String name=request.getParameter("name");
String manu=request.getParameter("manufacturer");
String appnumb=request.getParameter("appnumb");
String medicament=request.getParameter("medicament");
String pg=request.getParameter("pg");
List<Product> p_list=new AchievementDAO().getProduct(Integer.valueOf(pg),20,name,medicament,manu,appnumb);
request.setAttribute("p_list",p_list);
%>
<div style="margin:5px;text-align:left;padding:0 0 5px 10px;border-bottom:1px dotted #2fa1c6;">
  	<fieldset>
  		<legend>成果查询</legend>
  		<form action="<c:url value='/achievement/productlist.jsp' />" method="get">
  			<label>产品名：</label><input name="name" type="text" style="width:115px;">
				<label>药品名：</label><input name="medicament" type="text" style="width:115px;">
				<label>准字号:</label><input name="appnumb" type="text" style="width:115px;"><br>
				<label>生产公司:</label><input name="manufacturer" type="text" style="width:425px;">
				<input type="hidden" name="pg" value="1">
				<input type="submit" value="查询">
  		</form>
  	</fieldset>
  </div>
  	<table width="100%" cellspacing="0" border="0">
  		<tr>
  		<th class="thclass">编号</th>
  		<th class="thclass">产品名</th>
  		<th class="thclass">药品名</th>
  		<th class="thclass">药品名</th>
  		<th class="thclass">生产公司</th>
  		</tr>
  		
  		<c:forEach items="${requestScope.p_list}" var="p" varStatus="status">
  		<c:choose>
					<c:when test="${status.index%2==0 }">
					<tr style="background-color:#cccccc" class="show">
					</c:when>
				<c:otherwise>
					<tr class="show">
				</c:otherwise>
					
				</c:choose>
					<td class="tdclass">${(status.index+1)}</td>
					<td class="tdclass" id="getrl" >
					<a  action="<c:url value='/GetRelationYiqi'/>" style="cursor:pointer">${p.name}</a>
					</td>
					
					<td class="tdclass" id="getrl" >
						<a  style="cursor:pointer" action="<c:url value='/GetRelationYiqi'/>" >${p.medicament}</a>
					</td>
					<td class="tdclass" >
						${p.appnumb}
					</td>
				<td class="tdclass" id="getrl"  style="cursor:pointer">
						<a  style="cursor:pointer" action="<c:url value='/GetRelationYiqi'/>" >${p.manufacturer}</a>
					</td>
  			</tr>
  			<tr>
					<td class="tdclass" colspan="5" style="display:none;padding:5px 5px 5px 0px;text-align:left">
						
					</td>
				</tr>
  		</c:forEach>
  		
  	</table>
  <div id="pages" style="margin-top:20px;">
                	
                	         	
                每页<span>20</span>条,第<span>${param.pg}</span>页,该页
                	<span>${fn:length(requestScope.list) }</span>条
                    <c:choose>
                		<c:when test='${param.pg==null||param.pg==""||param.pg==1}'>
                			上页
                		</c:when>
                		<c:otherwise>
                			<c:url value='/achievement/productlist.jsp?pg=${param.pg-1}&name=${param.name}&appnumb=${param.medicament}&author=${param.medicament}&manufacturer=${param.manufacturer}'
                			 var="down"/>
                			 <a href="${down}">上页</a>
                		</c:otherwise>
                	</c:choose>
                	
                   	<c:choose>
                   		<c:when test="${fn:length(requestScope.i_list)<20}">
                   			下页
                   		</c:when>
                   		<c:otherwise>
                   		<a href="<c:url value='/achievement/productlist.jsp?pg=${param.pg+1}&name=${param.name}&appnumb=${param.medicament}&author=${param.medicament}&manufacturer=${param.manufacturer}' />">下页</a>
                   		</c:otherwise>
                   	</c:choose>
                    
                </div>
</body>
</html>